<template>
	<view class="main">
		<view class="top"></view>
		<view class="content">
			<view class="swiper">
				<u-swiper @change="e => currentNum = e.current" :list="list1" :height="150" :radius="0">
					<view slot="indicator" class="indicator-num">
						<text class="indicator-num__text">{{ currentNum + 1 }}/{{ list1.length }}</text>
					</view>
				</u-swiper>
			</view>
			<view class="item-single item-other">
				<span class="item-single-name item-single-name-other">名称</span>
				<span class="item-single-value item-single-value-other">{{dataInfo.name}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">供应商名称</span>
				<span class="item-single-value">{{dataInfo.applicantName}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">品类</span>
				<span class="item-single-value">{{dataInfo.category}}</span>
			</view>
			
			<view class="item-single">
				<span class="item-single-name">单价</span>
				<span class="item-single-value">¥{{dataInfo.unitPrice}}/kg</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">数量</span>
				<span class="item-single-value">{{dataInfo.num}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">总价</span>
				<span class="item-single-value">¥{{dataInfo.totalPrice}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">投标信息</span>
				<span class="item-single-value">{{dataInfo.remark}}</span>
			</view>
		</view>
		
		<!--底部按钮-satrt-->
		<view class="btn">
			<view class="btn-item btn-item-left" @click="submit(2)">不通过</view>
			<view class="btn-item btn-item-right" @click="submit(1)">通过</view>
		</view>
		<!--底部按钮-end-->
		
		<u-overlay :show="showAudit">
			<auditForm  @close="closePop" @comPop="comPop"></auditForm>
		</u-overlay>
	</view>
</template>


<script>
	import auditForm from '@/components/auditForm.vue'
	export default {
		components:{auditForm},
		
		data() {
			return {
				showAudit: false,
				postData:{},
				currentNum: 0,
				dataInfo:{},
				list1: [],
			}
		},
		onLoad(options) {
			this.postData.id = options.id
			this.getInfo()
		},

		methods: {
			getInfo(){
				let that = this
				this.$postjson('/api/RqOffer/info',{id:this.postData.id}).then(res=>{
					this.dataInfo = res.data.data
					let tem =  this.dataInfo.imges?this.dataInfo.imges.split(','):[]
					tem.forEach(v=>{
					 that.list1.push( that.baseUrl +v)
					})
				})
			},
			submit(state){
				this.postData.state = state
				if(state == 1){
					this.postData.note = ''
					this.examine()
				}else{
					this.showAudit = true
				}
			},
			
			closePop(){
				this.showAudit = false
			},
			comPop(data){
				if(!data.note){
					uni.$u.toast('请填写驳回原因')
					return
				}
				this.postData.rason = data.note
				this.examine()	
			},
			examine(){
				uni.showLoading({
					title: '提交中'
				});
				let that = this
				this.$postjson('/api/RqOffer/examine', this.postData).then( res => {
					if (res.data.code == 200) {
						setTimeout(v => {
							uni.navigateBack()
							that.showAudit = false
						}, 1000)
						uni.$u.toast('操作成功')
					} else {
						this.$modal.msgInfo(res.data.msg)
					}					
				})
			}
		},


	}
</script>

<style lang="scss" scoped>
	.swiper{
		margin-bottom:76upx
	}
	.indicator-num {
		padding: 2px 0;
		background-color: rgba(0, 0, 0, 0.35);
		border-radius: 100px;
		width: 35px;
		@include flex;
		justify-content: center;
	
		&__text {
			color: #FFFFFF;
			font-size: 12px;
		}
	}
	page{
		background: #F9F9F9;
	}
	.top{
		width: 100%;
		height: 154rpx;
		background: linear-gradient( -180deg, #11AA66 0%, #12C66B 100%);
	}
	.content{
		width: calc(100% - 24upx - 60upx);
		margin: -134upx auto 0 auto;
		// height: 820rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 6rpx 34rpx 0rpx rgba(159,186,174,0.1);
		border-radius: 10rpx;
		padding: 40upx 30upx;
	}
	.item-single {
		display: flex;
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #666666;
		margin-top: 30upx;
	}
	
	.item-single-name {
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #666666;
		width: 120rpx;
		display: inline-block;
		margin-right: 12upx;
		
	}
	
	.item-single-value {
		display: inline-block;
		width: calc(100% - 120upx - 12upx);
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #111111;
	}
	.item-other{
		padding-bottom: 30upx;
		border-bottom: 1rpx solid rgba(228, 228, 228, 0.6);
	}
	.item-single-name-other{
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #111111;
	}
	.item-single-value-other{
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #111111;
	}
	
	.btn {
		position: fixed;
		bottom: 0;
		left: 0;
		height: 118rpx;
		background: #FFFFFF;
		box-shadow: 0rpx -2rpx 0rpx 0rpx rgba(0, 0, 0, 0.06);
		padding-bottom: 68rpx;
		padding-left: 30upx;
		padding-right: 30upx;
		padding-top: 30upx;
		width: calc(100% - 60upx);
		display:flex;
		justify-content: space-between;

	
		.btn-item {
			font-family: PingFangSC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #FFFFFF;
			text-align: center;
			width: 276rpx;
			height: 88rpx;
			background: linear-gradient(138deg, #12C66B 0%, #11AA66 100%);
			border-radius: 44rpx;
			margin: auto;
			line-height: 88upx;
		}
		.btn-item-left{
			background: #fff !important;
			border: 2rpx solid #11AA66;
			color: #11AA66;
		}
	}
</style>